﻿//选择客户(单选）
var columns =
            [
                 { display: 'Key', name: 'Id', type: 'text', hide: 1 },
                { display: '客户名称', name: 'ClientName', mintWidth: 80, width: 120 }, //, type: 'int', mintWidth: 40, width: 100
                {display: '客户编码', name: 'ClientCode', mintWidth: 100, width: 140},
                { display: '客户简称', name: 'ShortName', mintWidth: 100, width: 140 },
                { display: '电话', name: 'ClientPhone', mintWidth: 80, width: 120 },
                { display: '电子邮件', name: 'Email', mintWidth: 80, width: 120 },
                { display: '开户行', name: 'BankName', mintWidth: 150, width: 200 },
                { display: '银行账号', name: 'AccountNnmber', mintWidth: 100, width: 120 },
                 { display: '客户地址', name: 'ClientAddress', mintWidth: 100, width: 200 }
             ];

var manager;
$(document).ready(function () {
    initligerGrid();
    $("#btnSearch").unbind("click").bind("click", initligerGrid);
    $("#submitBtn").unbind("click").bind("click", selectOperation);
});

function initligerGrid() {
    manager = null;
    manager = $("#clientsGrid").ligerGrid({
        columns: columns,
        title: '客户信息管理',
        showTitle: true,
        width: '100%',
        enabledSort: true,
        height: '438',
        checkbox: false,
        rownumbers: true,
        parms: { orgCode: $("#HidOrgCode").val(),haseal:$("#HidHasSeal").val(), ClientName: $("#ClientName").val(), ClientCode: $("#ClientCode").val(), Deleted: ($("#Deleted").attr("checked") == true ? 1 : 0) },
        url: "../Client/GetClients?orgCode="+ $("#HidOrgCode").val()
    });
}


//update 
function selectOperation() {
    var row = manager.getSelectedRow();
    if (!row) {
        $.ligerDialog.success('请选择客户!'); return;
    }
    window.returnValue = [row.ClientName, row.Key ];
    window.close();
}


